//
//  ViewController.m
//  自定义转场动画
//
//  Created by zxy on 2019/4/18.
//  Copyright © 2019 zxy. All rights reserved.
//

#import "ViewController.h"
#import "MainController.h"
#import "Present/PresentionAnimator.h"
#define screenW ([UIScreen mainScreen].bounds.size.width)
#define screenH ([UIScreen mainScreen].bounds.size.height)
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIButton *jumpBtn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *centery;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *centerx;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (IBAction)jump:(UIButton *)sender {
    
    
    PresentionAnimator *presentAnimator = [[PresentionAnimator alloc]init];
    //设置展示视图大小
    presentAnimator.presentFrame = CGRectMake(screenW *0.5 - 75,screenH * 0.5 - 210,150,200);

    MainController *popVc = [[MainController alloc]init];
    // 必须设置 presentedViewController 的 modalPresentationStyle
    // 在自定义动画效果的情况下，苹果强烈建议设置为 UIModalPresentationCustom
    popVc.modalPresentationStyle = UIModalPresentationCustom;
    popVc.transitioningDelegate = presentAnimator;
    [self presentViewController:popVc animated:YES completion:nil];
}

@end
